<?php

	global $wpdb;
	require_once("packageclass.php");
	$objPack = new packageClass();
	$table_name =  'wp_spec_service_area';
	$pagename   =  ' Service Area';
	
	$addme=$_POST["addme"];
	

	$act=$_REQUEST["act"];
	if($act=="upd")
	{
		$recid=$_REQUEST["id"];
		$sSQL="select * from ".$table_name ." where id=$recid";
		$result = mysql_query($sSQL) or die ('Error, query failed');
		if (mysql_num_rows($result) > 0 )
		{
			if($row = mysql_fetch_assoc($result))
			{
				$id        		= $row['id'];
				$zip  			= $row['zip'];
				$status      	= $row['status'];
				$btn	   = "Update".$pagename;
				$hidval	   = 2;
			}
		}
	}
	else
	{
		$btn	     ="Add New".$pagename;
		$id          = "";
		$name  	     = "";
		$description = "";
		$terms       = "";
		$sort_order  = "";
		$hidval	     = 1;

	}
?>
<div xmlns="http://www.w3.org/1999/xhtml" class="wrap nosubsub">

	<div class="icon32" id="icon-edit"><br/></div>
<h2>Add New Service&nbsp;Area</h2>
<div id="col-left">
	<div class="col-wrap">
		<div>
			<div class="form-wrap">
				<h3></h3>
				<form class="validate" action="admin.php" enctype="multipart/form-data" method="post" id="addtag">
					<div class="form-field">
						<label for="tag-name">Zip Code</label>

						<input type="text" size="10" style="width:100px;" id="zip" name="zip" value="<?php echo $zip; ?>"/>
					</div>
                    
                   
			  <p class="submit">
						<input type="submit" value="<?php echo $btn; ?>" class="button" id="submit" name="submit_service_area"/>
						<input type="hidden" name="id" value=<?php echo $id;?> >
                       	<input type="hidden" name="addme" value=<?php echo $hidval;?> >
					</p>
				</form>
			</div>
		</div>
	</div>
</div>
</div>
<script>
jQuery("#menu-settings").removeClass();
jQuery("#menu-settings").addClass( "wp-has-submenu wp-has-current-submenu wp-menu-open menu-top menu-icon-settings menu-top-last" );
jQuery("#menu-settings").css("background-color", "#0074a2");
</script>